-- Restador de exponentes solamente

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity restador2 is
port(p,q: in std_logic_vector(7 downto 0);
     dif: out std_logic_vector(7 downto 0));
end restador2;

--p,q exponentes 
--dif = |p - q|

architecture behavior of restador2 is
begin
process(p,q)
variable s: std_logic_vector(7 downto 0);
begin
   s := signed(p) -signed(q);
   dif <= std_logic_vector(unsigned(s));
end process;
end behavior;